<!DOCTYPE html>
<html lang="en">





<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.png">
  <link rel="icon" type="image/png" href="/img/favicon.png">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="description" content="My Personal Website For Blog">
  <meta name="author" content="黄宇辉">
  <meta name="keywords" content="learning note,hexo blog">
  <title>Hi Redis ~ - 欢迎参观小灰灰的网站哟 ヾ(◍°∇°◍)ﾉﾞ ~</title>

  <link  rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.staticfile.org/github-markdown-css/4.0.0/github-markdown.min.css" />
  <link  rel="stylesheet" href="/lib/hint/hint.min.css" />

  
    <link  rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/10.0.0/styles/vs2015.min.css" />
  

  


<!-- 主题依赖的图标库，不要自行修改 -->
<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_yg9cfy8wd6.css">

<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_pjno9b9zyxs.css">

<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script  src="/js/utils.js" ></script>
</head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand"
       href="/">&nbsp;<strong>ANONYMOUS</strong>&nbsp;</a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                Home
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                Archives
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                Tags
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                About
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" data-toggle="modal" data-target="#modalSearch">&nbsp;&nbsp;<i
                class="iconfont icon-search"></i>&nbsp;&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="view intro-2" id="background" parallax=true
         style="background: url('/img/default.png') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="container text-center white-text fadeInUp">
            <span class="h2" id="subtitle">
              
            </span>

            
              
  <div class="mt-3 post-meta">
    <i class="iconfont icon-date-fill" aria-hidden="true"></i>
    <time datetime="2019-06-25 16:13">
      June 25, 2019 pm
    </time>
  </div>


<div class="mt-1">
  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      840 字
    </span>
  

  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      11
       分钟
    </span>
  

  
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid">
  <div class="row">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-md">
      <div class="container nopadding-md" id="board-ctn">
        <div class="py-5" id="board">
          <div class="post-content mx-auto" id="post">
            
            <article class="markdown-body">
              <h2 id="学习笔记-拥抱Redis"><a href="#学习笔记-拥抱Redis" class="headerlink" title="学习笔记 : 拥抱Redis ~"></a>学习笔记 : 拥抱Redis ~</h2><p><em>简介 : <code>Redis</code>(REmote DIctionary Server)是一个非常流行的基于内存的轻量级键值数据库(key-value database). 严格的说与其把Redis称为一种数据库,不如把它称为一种数据服务器更为恰当(<code>https://matt.sh/thinking-in-redis-part-one</code>). Redis原生地在内存中实现了多种类型的数据结构,并提供了操作这些数据结构的多种API. 更加重要的是,作为一个需要长期运行的数据库存储服务,Redis还提供了高性能命令处理,高可靠性/扩展性的架构及数据持久化等特性 .</em></p>
<ul>
<li><em>微软开源技术小组(Microsoft Open Technologies group)曾经维护了一个Windows的Redis发行版(😅小哥的联想小新潮中Ubuntu系统好久没玩过了啊,要不先在Windows系统下学习Redis吧, (#→⌒→)都是借口,大懒蛋 ~) : <a href="https://github.com/microsoftarchive/redis/releases" target="_blank" rel="noopener">https://github.com/microsoftarchive/redis/releases</a></em></li>
</ul>
<h3 id="Windows-Redis安装文件说明"><a href="#Windows-Redis安装文件说明" class="headerlink" title="Windows-Redis安装文件说明"></a>Windows-Redis安装文件说明</h3><ol>
<li><em>redis.windows.conf          —redis的配置文件:将redis作为普通软件使用的配置</em></li>
<li><em>redis.windows-service.conf  —redis的配置文件:将redis作为系统服务的配置</em></li>
<li><em>redis-benchmark.exe         —测试工具:测试redis的读写性能情况</em></li>
<li><em>redis-check-aof.exe         —aof 修复检查日志</em></li>
<li><em>redis-cli.exe               —redis客户端程序</em></li>
<li><em>redis-server.exe            —redis服务器程序</em></li>
</ol>
<h3 id="Redis临时服务"><a href="#Redis临时服务" class="headerlink" title="Redis临时服务"></a>Redis临时服务</h3><ol>
<li><p><em>进入Redis安装包目录,启动Redis临时服务的命令为 : <code>redis-server redis.windows.conf</code>  ,通过该命令可以创建Redis临时服务,既Services列表中不会出现Redis的服务名及其状态,关闭从此窗口既关闭Redis服务.</em></p>
<div class="hljs"><pre><code class="hljs maxima">E:\MS-Redis\Redis
λ redis-server.exe redis.windows.conf
                <span class="hljs-symbol">_</span>.<span class="hljs-symbol">_</span>
           <span class="hljs-symbol">_</span>.-``<span class="hljs-symbol">__</span> ''-.<span class="hljs-symbol">_</span>
      <span class="hljs-symbol">_</span>.-``    `.  `<span class="hljs-symbol">_</span>.  ''-.<span class="hljs-symbol">_</span>           Redis <span class="hljs-number">3.2</span><span class="hljs-number">.100</span> (<span class="hljs-number">00000000</span>/<span class="hljs-number">0</span>) <span class="hljs-number">64</span> bit
  .-`` .-```.  ```\/    <span class="hljs-symbol">_</span>.,<span class="hljs-symbol">_</span> ''-.<span class="hljs-symbol">_</span>
 (    '      ,       .-`  | `,    )     Running <span class="hljs-keyword">in</span> standalone mode
 |`-.<span class="hljs-symbol">_</span>`-...-` <span class="hljs-symbol">__</span>...-.``-.<span class="hljs-symbol">_</span>|'` <span class="hljs-symbol">_</span>.-'|     Port: <span class="hljs-number">6379</span>
 |    `-.<span class="hljs-symbol">_</span>   `.<span class="hljs-symbol">_</span>    /     <span class="hljs-symbol">_</span>.-'    |     PID: <span class="hljs-number">3796</span>
  `-.<span class="hljs-symbol">_</span>    `-.<span class="hljs-symbol">_</span>  `-./  <span class="hljs-symbol">_</span>.-'    <span class="hljs-symbol">_</span>.-'
 |`-.<span class="hljs-symbol">_</span>`-.<span class="hljs-symbol">_</span>    `-.<span class="hljs-symbol">__</span>.-'    <span class="hljs-symbol">_</span>.-'<span class="hljs-symbol">_</span>.-'|
 |    `-.<span class="hljs-symbol">_</span>`-.<span class="hljs-symbol">_</span>        <span class="hljs-symbol">_</span>.-'<span class="hljs-symbol">_</span>.-'    |           http://redis.io
  `-.<span class="hljs-symbol">_</span>    `-.<span class="hljs-symbol">_</span>`-.<span class="hljs-symbol">__</span>.-'<span class="hljs-symbol">_</span>.-'    <span class="hljs-symbol">_</span>.-'
 |`-.<span class="hljs-symbol">_</span>`-.<span class="hljs-symbol">_</span>    `-.<span class="hljs-symbol">__</span>.-'    <span class="hljs-symbol">_</span>.-'<span class="hljs-symbol">_</span>.-'|
 |    `-.<span class="hljs-symbol">_</span>`-.<span class="hljs-symbol">_</span>        <span class="hljs-symbol">_</span>.-'<span class="hljs-symbol">_</span>.-'    |
  `-.<span class="hljs-symbol">_</span>    `-.<span class="hljs-symbol">_</span>`-.<span class="hljs-symbol">__</span>.-'<span class="hljs-symbol">_</span>.-'    <span class="hljs-symbol">_</span>.-'
      `-.<span class="hljs-symbol">_</span>    `-.<span class="hljs-symbol">__</span>.-'    <span class="hljs-symbol">_</span>.-'
          `-.<span class="hljs-symbol">_</span>        <span class="hljs-symbol">_</span>.-'
              `-.<span class="hljs-symbol">__</span>.-'

[<span class="hljs-number">3796</span>] <span class="hljs-number">25</span> Jun <span class="hljs-number">17</span>:<span class="hljs-number">20</span>:<span class="hljs-number">55.403</span> # Server started, Redis version <span class="hljs-number">3.2</span><span class="hljs-number">.100</span>
[<span class="hljs-number">3796</span>] <span class="hljs-number">25</span> Jun <span class="hljs-number">17</span>:<span class="hljs-number">20</span>:<span class="hljs-number">55.403</span> * DB loaded from disk: <span class="hljs-number">0.000</span> seconds
[<span class="hljs-number">3796</span>] <span class="hljs-number">25</span> Jun <span class="hljs-number">17</span>:<span class="hljs-number">20</span>:<span class="hljs-number">55.403</span> * The server <span class="hljs-built_in">is</span> now ready to accept connections on port <span class="hljs-number">6379</span></code></pre></div>
</li>
<li><p><em>启动Redis服务后再开启一个<code>cmder</code>窗口,运行客户端程序</em></p>
<div class="hljs"><pre><code class="hljs t">E:\MS-Redis\Redis
λ redis-cli.exe # 运行客户端程序的命令
127.0.0.1:6379&gt; set firstKey HelloRedis~
OK
127.0.0.1:6379&gt; get firstKey
&quot;HelloRedis~&quot;</code></pre></div>


</li>
</ol>
<h3 id="Redis默认服务安装"><a href="#Redis默认服务安装" class="headerlink" title="Redis默认服务安装"></a>Redis默认服务安装</h3><p><em>进入Redis安装包目录,执行将Redis注册为服务的命令,执行该命令后Services列表中将出现<code>Redis</code>服务,但此时该服务并非启动状态,需要执行Redis启动命令来启动服务,启动服务后,即可运行客户端程序哟 ~</em></p>
<div class="hljs"><pre><code class="hljs t">E:\MS-Redis\Redis 
λ redis-server --service-install redis.windows.conf # 将Redis注册为服务的命令

E:\MS-Redis\Redis
λ redis-server --service-start # 启动服务命令
[18704] 25 Jun 17:55:33.957 # Redis service successfully started.

E:\MS-Redis\Redis
λ redis-cli.exe # 运行客户端程序的命令
127.0.0.1:6379&gt; set firstKey helloRedis~
OK
127.0.0.1:6379&gt; get firstKey
&quot;helloRedis~&quot;
127.0.0.1:6379&gt; exit # 退出

E:\MS-Redis\Redis
λ redis-server --service-stop # 停止命令命令
[7784] 25 Jun 18:09:43.467 # Redis service successfully stopped.

E:\MS-Redis\Redis
λ redis-server --service-uninstall # 卸载服务命令
[11968] 25 Jun 18:13:44.417 # Redis service successfully uninstalled.</code></pre></div>


<ul>
<li><em>参考书籍 : Redis 4.x CookBook ——黄鹏程,王左非 · 著</em></li>
</ul>

            </article>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/Redis/">Redis</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" target="_blank" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！</p>
              
              
                <div class="post-prevnext row">
                  <div class="post-prev col-6">
                    
                    
                      <a href="/2019/06/26/Spring-Boot%E4%B9%8B%E5%9F%BA%E6%9C%ACWeb%E5%BC%80%E5%8F%91/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Spring Boot之基本Web开发</span>
                        <span class="visible-mobile">Previous</span>
                      </a>
                    
                  </div>
                  <div class="post-next col-6">
                    
                    
                      <a href="/2019/06/23/Hi-Spring-Boot/">
                        <span class="hidden-mobile">Hi Spring Boot ~</span>
                        <span class="visible-mobile">Next</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </div>
                </div>
              
            </div>

            
          </div>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;TOC</p>
  <div id="tocbot"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    
  </main>

  
    <a id="scroll-top-button" href="#" role="button">
      <i class="iconfont icon-arrowup" aria-hidden="true"></i>
    </a>
  

  
    <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">Search</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">keyword</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
  

  

  

  <footer class="mt-5">
  <div class="text-center py-3">
    <div>
      <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a>
      <i class="iconfont icon-love"></i>
      <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener">
        <span>Fluid</span></a>
    </div>
    
  <div class="statistics">
    
    

    
      
        <!-- 不蒜子统计PV -->
        <span id="busuanzi_container_site_pv" style="display: none">
            总访问量 
            <span id="busuanzi_value_site_pv"></span>
             次
          </span>
      
      
        <!-- 不蒜子统计UV -->
        <span id="busuanzi_container_site_uv" style="display: none">
            总访客数 
            <span id="busuanzi_value_site_uv"></span>
             人
          </span>
      
    
  </div>


    

    
  </div>
</footer>

<!-- SCRIPTS -->
<script  src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js" ></script>
<script  src="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/js/bootstrap.min.js" ></script>
<script  src="/js/debouncer.js" ></script>
<script  src="/js/main.js" ></script>

<!-- Plugins -->


  
    <script  src="/js/lazyload.js" ></script>
  



  <script defer src="https://cdn.staticfile.org/clipboard.js/2.0.6/clipboard.min.js" ></script>
  <script  src="/js/clipboard-use.js" ></script>



  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>





  <script  src="https://cdn.staticfile.org/tocbot/4.11.1/tocbot.min.js" ></script>
  <script>
    $(document).ready(function () {
      var boardCtn = $('#board-ctn');
      var boardTop = boardCtn.offset().top;

      tocbot.init({
        tocSelector: '#tocbot',
        contentSelector: 'article.markdown-body',
        headingSelector: 'h1,h2,h3,h4,h5,h6',
        linkClass: 'tocbot-link',
        activeLinkClass: 'tocbot-active-link',
        listClass: 'tocbot-list',
        isCollapsedClass: 'tocbot-is-collapsed',
        collapsibleClass: 'tocbot-is-collapsible',
        collapseDepth: 0,
        scrollSmooth: true,
        headingsOffset: -boardTop
      });
      if ($('.toc-list-item').length > 0) {
        $('#toc').css('visibility', 'visible');
      }
    });
  </script>



  <script  src="https://cdn.staticfile.org/typed.js/2.0.11/typed.min.js" ></script>
  <script>
    var typed = new Typed('#subtitle', {
      strings: [
        '  ',
        "Hi Redis ~&nbsp;",
      ],
      cursorChar: "_",
      typeSpeed: 70,
      loop: false,
    });
    typed.stop();
    $(document).ready(function () {
      $(".typed-cursor").addClass("h2");
      typed.start();
    });
  </script>



  <script  src="https://cdn.staticfile.org/anchor-js/4.2.2/anchor.min.js" ></script>
  <script>
    anchors.options = {
      placement: "right",
      visible: "hover",
      
    };
    var el = "h1,h2,h3,h4,h5,h6".split(",");
    var res = [];
    for (item of el) {
      res.push(".markdown-body > " + item)
    }
    anchors.add(res.join(", "))
  </script>



  <script  src="/js/local-search.js" ></script>
  <script>
    var path = "/local-search.xml";
    var inputArea = document.querySelector("#local-search-input");
    inputArea.onclick = function () {
      searchFunc(path, 'local-search-input', 'local-search-result');
      this.onclick = null
    }
  </script>



  <script  src="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.css" />

  <script>
    $('#post img:not(.no-zoom img, img[no-zoom]), img[zoom]').each(
      function () {
        var element = document.createElement('a');
        $(element).attr('data-fancybox', 'images');
        $(element).attr('href', $(this).attr('src'));
        $(this).wrap(element);
      }
    );
  </script>







  
  
    <script>
      !function (e, t, a) {
        function r() {
          for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x + "px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e].scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999");
          requestAnimationFrame(r)
        }

        function n() {
          var t = "function" == typeof e.onclick && e.onclick;
          e.onclick = function (e) {
            t && t(), o(e)
          }
        }

        function o(e) {
          var a = t.createElement("div");
          a.className = "heart", s.push({
            el: a,
            x: e.clientX - 5,
            y: e.clientY - 5,
            scale: 1,
            alpha: 1,
            color: c()
          }), t.body.appendChild(a)
        }

        function i(e) {
          var a = t.createElement("style");
          a.type = "text/css";
          try {
            a.appendChild(t.createTextNode(e))
          } catch (t) {
            a.styleSheet.cssText = e
          }
          t.getElementsByTagName("head")[0].appendChild(a)
        }

        function c() {
          return "rgb(" + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + ")"
        }

        var s = [];
        e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function (e) {
          setTimeout(e, 1e3 / 60)
        }, i(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"), n(), r()
      }(window, document);
    </script>
  














</body>
</html>
